package iqq.client;

import iqq.im.QQNotifyListener;
import iqq.im.WebQQClient;
import iqq.im.actor.ThreadActorDispatcher;

public class ClientService {
	private static WebQQClient webQQClient;

	private ClientService() {
	}

	public static WebQQClient geInstance() {
		if (webQQClient == null) {
			throw new IllegalArgumentException("client is no login !!!");
		}
		return webQQClient;
	}

	public static WebQQClient login(String username, String password,
			QQNotifyListener notifyListener) {
		if (webQQClient == null) {
			webQQClient = new WebQQClient(username, password,
					QQNotifyManager.getInstance(), new ThreadActorDispatcher());
			doLogin(webQQClient, null);
			return webQQClient;
		}
		throw new IllegalArgumentException("client is aready logined !!!");
	}

	public static void doLogin(WebQQClient client, String code) {
		// client.login(code, QQActionManager.getInstance());
	}

	public static void doVerify(WebQQClient client) {
		client.getCaptcha(QQCaptchaActionManager.getInstance());
	}
}
